package com.cdc.http.http2;

import java.util.List;
import java.util.Map;

/**
 * Created by admin on 2018/3/24.
 */

public class Response<T> {
    private int responseCode;
    //服务器的响应数据
    private T responseBody;
    private Exception exception;
    private Request request;

    private Map<String,List<String>> responseHeaders;

     Response(int responseCode, Map<String,List<String>> responseHeaders, Exception exception, Request request) {
        this.responseCode = responseCode;
        this.responseHeaders=responseHeaders;
        this.exception = exception;
        this.request = request;
    }

    public Map<String, List<String>> getResponseHeaders() {
        return responseHeaders;
    }

    public Request getRequest() {
        return request;
    }



    public int getResponseCode() {
        return responseCode;
    }

    /***
     * 获取服务器的响应
     * @return
     */
    public T getResult() {
        return responseBody;
    }

    /**
     * 设置响应
     * @param result
     */
    void setResult(T result) {
        this.responseBody = result;
    }

    public Exception getException() {
        return exception;
    }

     void setException(Exception exception) {
        this.exception = exception;
    }
}
